# Slack
# Slack Attachments JSON
Action Function: The Slack Attachments JSON action provides a convenient means of adding an attachment array to the Slack Post action.
Action Outputs: The action will output either:
Successful – The action executed without error
Unsuccessful – An error occurred in performing the action's execution
Label
A label for the action in the diagram
Properties
Existing Attachments JSON
This property allows the results of a different Slack Attachments action's results to be injected into the current action's attachment payload. Using the results workflow variable from a different Slack Attachments action, the results variable can be referenced within another Slack Attachments action. The syntax V{{MyResultsVariable}}, where "MyResultsVariable" is the name of the variable used for the first action's results property, will allow another action's results to be used as the attachments for another action. More attachments may still be added with the following attachments property detailed below.
Attachments
title - The attachments title
text - The text for the attachment's title
title_link - An optional HTML link for the title
color - The text color
Fields
title - A title for the field
value - The text for the associated field
short - Boolean (true/false) value
Web Timeout(sec)
This is the number of seconds allowed for a web request before it times out. A default value is used if a value is not provided. If the web service is slow or is returning or receiving a large amount of data, a value such as 600 seconds or larger can be supplied.
Variable For Storing Error Message
Specifies the variable which will store any error messages that occur.
Results
Specifies the variable which will store the result.
# Slack Message
Action Function: The Slack Message action allows a message to be posted to a specified slack channel.
Action Outputs: The action will output either:
Successful – The action executed without error
Unsuccessful – An error occurred in performing the action's execution
Label
A label for the action in the diagram
Properties
Authentication Scenario
Specifies the credentials and access details. Scenarios for Slack actions are defined within the “Slack.Config.xml” connector configuration.
Multiple authentication scenarios may be defined in the scenario configuration XML document.
Sample scenarios:
<slack>
<scenarios>
<!-- The Slack Message connector supports multiple configuration scenarios, and uses KMS to automatically encrypt the authentication token -->
<!-- Both name and authToken attributes are required for this action -->
<scenario name="MyExampleScenario" authToken="my_unencrypted_token_value"></scenario>
<scenario name="MyExampleScenario2" authToken="my_unencrypted_token_value"></scenario>
</scenarios>
</slack>
URL
This property is required and specifies the URL to be used. An example URL for
this action would be Slack's API for posting messages: https://slack.com/api/chat.postMessage
The URL may also be dynamic based on the response_url from a previous message.
Payload
The payload property defines the message which will be posted. The channel property is required unless a webhook is being used as the URL. If a webhook is used for the URL, the channel is associated to the webhook's channel.
A simple message example:
{
channel: "channel_id",
text: "My Message"
}
Web Timeout(sec)
This is the number of seconds allowed for a web request before it times out. A default value is used if a value is not provided. If the web service is slow or is returning or receiving a large amount of data, a value such as 600 seconds or larger can be supplied.
Variable For Storing Error Message
Specifies the variable which will store any error messages that occur.
Results
Specifies the variable which will store the result.
# Slack Interactive Post
Action Function: The Slack Interactive Post action allows a message to be posted to a specified slack channel with an interactive message as the payload.
Action Outputs: The action will output either:
Successful – The action executed without error
Unsuccessful – An error occurred in performing the action's execution
Label
A label for the action in the diagram
Properties
Authentication Scenario
Specifies the credentials and access details. Scenarios for Slack actions are defined within the “Slack.Config.xml” connector configuration.
Multiple authentication scenarios may be defined in the scenario configuration XML document.
Sample scenarios:
<slack>
<scenarios>
<!-- The Slack Interactive Post connector supports multiple configuration scenarios-->
<!-- Both name and baseurl attributes are required for this action -->
<scenario name="MyExampleScenario" baseurl="https://hooks.slack.com/services/..."></scenario>
<scenario name="MyExampleScenario2" baseurl="https://slack.com/api/chat.postMessage"></scenario>
</scenarios>
</slack>
Payload
The payload property defines the message which will be posted. The channel property is required unless a webhook is being used as the URL. If a webhook is used for the URL, the channel is associated to the webhook's channel.
An example interactive message:
{
"channel": "channelId", //not necessary when using a webhook
"text": "Would you like to play a game?",
"attachments": [
{
"text": "Choose a game to play",
"fallback": "You are unable to choose a game",
"callback_id": "wopr_game",
"color": "#3AA3E3",
"attachment_type": "default",
"actions": [
{
"name": "game",
"text": "Chess",
"type": "button",
"value": "chess"
},
{
"name": "game",
"text": "Falken's Maze",
"type": "button",
"value": "maze"
},
{
"name": "game",
"text": "Thermonuclear War",
"style": "danger",
"type": "button",
"value": "war",
"confirm": {
"title": "Are you sure?",
"text": "Wouldn't you prefer a good game of chess?",
"ok_text": "Yes",
"dismiss_text": "No"
}
}
]
}
]
}
Web Timeout(sec)
This is the number of seconds allowed for a web request before it times out. A default value is used if a value is not provided. If the web service is slow or is returning or receiving a large amount of data, a value such as 600 seconds or larger can be supplied.
Variable For Storing Error Message
Specifies the variable which will store any error messages that occur.
Results
Specifies the variable which will store the result.
# Slack Post
Action Function: The Slack Post action allows a message to be posted to a specified slack channel with, or without, attachments.
Action Outputs: The action will output either:
Successful – The action executed without error
Unsuccessful – An error occurred in performing the action's execution
Label
A label for the action in the diagram
Properties
Authentication Scenario
Specifies the credentials and access details. Scenarios for Slack actions are defined within the “Slack.Config.xml” connector configuration.
Multiple authentication scenarios may be defined in the scenario configuration XML document.
Sample scenarios:
<slack>
<scenarios>
<!-- The Slack Post connector supports multiple configuration scenarios-->
<!-- Both name and baseurl attributes are required for this action -->
<!-- The baseurl is the webhook associated with the slack channel -->
<scenario name="MyExampleScenario" baseurl="https://hooks.slack.com/services/..."></scenario>
<scenario name="MyExampleScenario2" baseurl="https://hooks.slack.com/services/..."></scenario>
</scenarios>
</slack>
Channel
The channel property should contain the value of the specific channel's id where the message will be posted.
Username
The username associated with the message.
Attachments JSON Array
This property is used to link the output of the Slack Attachments action with the Slack Post action. Attachments added to the Slack Attachments action can be referenced within Slack Post as a workflow variable. The workflow variable used should be the variable assigned to Slack Attachments results property. For example, if the variable assigned to the results property within the workflow action Slack Attachments was named "MyAttachmentsVariable", the value can be referenced within the Slack Post action using the syntax V{{MyAttachmentsVariable}}.
Web Timeout(sec)
This is the number of seconds allowed for a web request before it times out. A default value is used if a value is not provided. If the web service is slow or is returning or receiving a large amount of data, a value such as 600 seconds or larger can be supplied.
Variable For Storing Error Message
Specifies the variable which will store any error messages that occur.
Results
Specifies the variable which will store the result.